{#特价商品#}
{#<h3>{{ heading_title }}</h3>#}
<div class="product kill-goods">
    <div class="product-title" id="countdown">
        {#<span>倒數</span><span class="kill-number">10</span><span>:</span><span class="kill-number">51</span><span>:</span><span class="kill-number">45</span><span>結束</span>#}
    </div>
    <ul class="product-list">
        {% for product in products %}
            <li>
                <a href="{{ product.href }}">
                    <img src="{{ product.thumb }}" alt="{{ product.name }}">
                </a>
                <div class="product-info">
                    <a href="{{ product.href }}">
                        <div class="product-name">{{ product.name }}</div>
                    </a>
                    <div class="product-price">
                        {% if not product.special %}
                            <div class="new-price">{{ product.price }}</div>
                        {% else %}
                            <div class="new-price">{{ product.special }}</div>
                            <div class="old-price">{{ product.price }}</div>
                        {% endif %}
                    </div>
                </div>
            </li>
        {% endfor %}
    </ul>
</div>
<input type="hidden" value="{{ date_end }}" id="home_date_end">
<input type="hidden" value="{{ date_now }}" id="home_date_now">
<script>
    $(function () {
        countdown($('#home_date_now').val(), $('#home_date_end').val());
    });
    // 倒计时
    function countdown(startTime, endTime) {
        var allTime = endTime - startTime;
        var timer = setInterval(function () {
            if(allTime <= 0){
                $('#countdown').empty();
                clearInterval(timer);
                return false;
            }
            var tag = '<span>นับถอยหลัง</span><span class="kill-number">' + Math.floor(allTime/3600) + '</span><span>:</span><span class="kill-number">' + Math.floor((allTime%3600)/60) + '</span><span>:</span><span class="kill-number">' + (allTime%3600)%60 + '</span><span>สิ้นสุด</span>';
            $('#countdown').html(tag);
            allTime --;
        },1000)
    }
</script>
{#<div class="row">#}
    {#{% for product in products %}#}
        {#<div class="product-layout col-lg-3 col-md-3 col-sm-6 col-xs-12">#}
            {#<div class="product-thumb transition">#}
                {#<div class="image"><a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}"#}
                                                                     {#title="{{ product.name }}" class="img-responsive"/></a>#}
                {#</div>#}
                {#<div class="caption">#}
                    {#<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>#}
                    {#<p>{{ product.description }}</p>#}
                    {#{% if product.rating %}#}
                        {#<div class="rating">{% for i in 1..5 %}#}
                                {#{% if product.rating < i %} <span class="fa fa-stack"><i#}
                                            {#class="fa fa-star-o fa-stack-2x"></i></span> {% else %} <span#}
                                        {#class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i#}
                                            {#class="fa fa-star-o fa-stack-2x"></i></span> {% endif %}#}
                            {#{% endfor %}</div>#}
                    {#{% endif %}#}
                    {#{% if product.price %}#}
                        {#<p class="price"> {% if not product.special %}#}
                                {#{{ product.price }}#}
                            {#{% else %} <span class="price-new">{{ product.special }}</span> <span#}
                                    {#class="price-old">{{ product.price }}</span> {% endif %}#}
                            {#{% if product.tax %} <span#}
                                    {#class="price-tax">{{ text_tax }} {{ product.tax }}</span> {% endif %} </p>#}
                    {#{% endif %} </div>#}
                {#<div class="button-group">#}
                    {#<button type="button" onclick="cart.add('{{ product.product_id }}');"><i#}
                                {#class="fa fa-shopping-cart"></i> <span#}
                                {#class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span></button>#}
                    {#<button type="button" data-toggle="tooltip" title="{{ button_wishlist }}"#}
                            {#onclick="wishlist.add('{{ product.product_id }}');"><i class="fa fa-heart"></i></button>#}
                    {#<button type="button" data-toggle="tooltip" title="{{ button_compare }}"#}
                            {#onclick="compare.add('{{ product.product_id }}');"><i class="fa fa-exchange"></i></button>#}
                {#</div>#}
            {#</div>#}
        {#</div>#}
    {#{% endfor %} </div>#}
